package com.qzsoft.zhjd.home.v2.service.impl;

import java.util.List;
import java.util.Map;

import com.qzsoft.zhjd.home.v2.dto.ProductionCountDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qzsoft.jeemis.common.utils.ConvertDictUtils;
import com.qzsoft.zhjd.home.v2.dto.AsphaltDataWeightDto;
import com.qzsoft.zhjd.home.v2.dto.EnvDataDto;
import com.qzsoft.zhjd.home.v2.dto.MaterielCountDto;
import com.qzsoft.zhjd.home.v2.dto.MaterielDateTypeCountDto;
import com.qzsoft.zhjd.home.v2.dto.ProductionMonthCountDto;
import com.qzsoft.zhjd.home.v2.mapper.ZhjdHomeV2Mapper;
import com.qzsoft.zhjd.home.v2.service.ZhjdHomeV2Service;

/**
 * @ClassName ZhjdHomeServiceImpl
 * @Description 养护基地首页业务实现
 * @author linhuawei
 * @since 2022-08-17
 */
@Service
public class ZhjdHomeV2ServiceImpl implements ZhjdHomeV2Service {

    @Autowired
    private ZhjdHomeV2Mapper zhjdHomeV2Mapper;

    @Override
    public List<ProductionCountDto> productionCount(String baseCode) {
        return zhjdHomeV2Mapper.productionCount(baseCode);
    }

    @Override
    public List<ProductionMonthCountDto> productionAsphaltCount(String baseCode, Integer year) {
        return zhjdHomeV2Mapper.productionAsphaltCount(baseCode, year);
    }

    @Override
    public List<ProductionMonthCountDto> productionCementCount(String baseCode, Integer year) {
        return zhjdHomeV2Mapper.productionCementCount(baseCode, year);
    }

    @Override
    public List<AsphaltDataWeightDto> productionRealTime(Map<String, Object> params) {
        return zhjdHomeV2Mapper.productionRealTime(params);
    }

    @Override
    public MaterielCountDto materielCount(String baseCode, String weightType, String type, String time) {
        List<MaterielDateTypeCountDto> list = zhjdHomeV2Mapper.materielCount(baseCode, weightType, type, time);
        list = ConvertDictUtils.formatDicDataList(list);

        MaterielCountDto dto = new MaterielCountDto();
        dto.setList(list);
        dto.countTotal();
        return dto;
    }

    @Override
    public EnvDataDto envLatest(String baseCode) {
        return zhjdHomeV2Mapper.envLatest(baseCode);
    }

}
